unit mapchangeunit;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils;

type

  { TMapChange

    The class for storing changed tiles on the map. }

  TMapChange = class
  private
    function GetRight: Integer;
    procedure SetRight(ARight: Integer);
    function GetBottom: Integer;
    procedure SetBottom(ABottom: Integer);
  public
    Top, Left, Width, Height: Integer;
    FData: array of Integer;

    procedure ResetDataLength;

    property Right: Integer read GetRight write SetRight;
    property Bottom: Integer read GetBottom write SetBottom;
  end;

implementation

{ TMapChange }

function TMapChange.GetRight: Integer;
begin
  GetRight := Left + Width;
end;

procedure TMapChange.SetRight(ARight: Integer);
begin
  Width := ARight - Left;
end;

function TMapChange.GetBottom: Integer;
begin
  GetBottom := Top + Height;
end;

procedure TMapChange.SetBottom(ABottom: Integer);
begin
  Height := ABottom - Top;
end;

procedure TMapChange.ResetDataLength;
begin
  SetLength(FData, Width * Height);
end;

end.

